package com.example.administrator.hqq.utils.transform;

import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
import android.view.View;

/**
 * Created by lkq on 2018/1/30.
 * 为RecyclerView设置verticalSpacing
 */

public class SpacesItemDecoration extends RecyclerView.ItemDecoration {
    private int mVerticalSpacing, mHorizontalSpacing;

    public SpacesItemDecoration(int verticalSpacing, int horizontalSpacing) {
        mVerticalSpacing = verticalSpacing;
        mHorizontalSpacing = horizontalSpacing;
    }

    @Override
    public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
        outRect.left = mHorizontalSpacing;
        outRect.right = mHorizontalSpacing;
        outRect.bottom = mVerticalSpacing;
        outRect.top = mVerticalSpacing;
    }
}
